<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.6.0.min.js"></script>
    <script>
        $.ajax({
            url:"city",
            data:{"method":"findAllCityByPid","pid":0},
            type:"post",
            dataType:"json",
            success:function (data) {
                $(data).each(function (s, e) {
                    var op='<option value="'+e.cid+'">'+e.cname+'</option>>';
                    $("#province").append(op);

                })
            }
        })
        $(function () {
            $("#province").change(function () {
                var cid = $(this).val();
                $.ajax({
                    url:"city",
                    data:{"method":"findAllCityByPid","pid":cid},
                    type:"post",
                    dataType:"json",
                    success:function (data) {
                        $("#city").empty();
                        $(data).each(function (s, e) {
                            var op = '<option value="' + e.cid + '">' + e.cname + '</option>>';
                            $("#city").append(op);
                        });
                    }
                })

            })

        })
    </script>
</head>
<body>
    <select id="province" name="province">

    </select>
    省
    <select id="city" name="city">

    </select>
市
</body>
</html>